package hdfs_pro;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
public class DeleteFile {
    public static void main(String[] args) {
        try {
              Configuration conf = new Configuration();
              FileSystem fs = FileSystem.get(conf);
              String filePath = args[0];
          Path hdfsPath = new Path(filePath);  
          if(fs.delete(hdfsPath,false)){
              System.out.println("File "+ filePath +" has been deleted successfully!");
          }
        }catch(Exception e) {
            e.printStackTrace();
        }
    }
}